package threading;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-09-13
 * Time: 8:53
 */
//查看线程的几种状态
public class demo13 {
    public static void main(String[] args) {
        Thread t=new Thread(()->{
            for(int i=0;i<10000_0000;i++){

            }
        });
        //得到的就是NEW
        System.out.println(t.getState());
        t.start();
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(t.getState());
        try {
            t.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(t.getState());
    }
}
